@import '../variables/default.scss';
@import '../mixins/index.scss';

.at-pull-to-refresh {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;

  &--raw {
    .at-pull-to-refresh-indicator-down {
      display: none;
    }

    .at-load-more {
      display: none;
    }
  }

  .at-pull-to-refresh-wrapper {
    position: relative;
    width: 100%;
    height: 100%;

    &.transition {
      transition: 0.3s all;
    }
  }

  .at-pull-to-refresh-content {
    position: relative;
    width: 100%;

    &.transition {
      transition: 0.3s all;
    }
  }

  .at-pull-to-refresh-indicator-down {
    position: absolute;
    display: flex;
    width: 100%;
    height: $at-pull-to-refresh-indicator-height;
    top: -$at-pull-to-refresh-indicator-top;
    color: $at-activity-indicator-font-color;
    font-size: $at-activity-indicator-font-size;
    text-align: center;
    justify-content: center;
    align-items: center;

    .pull-down-text {
      margin: -20px * $hd 0 10px * $hd;
    }

    .dot {
      background-color: grey;
      width: $at-pull-to-refresh-indicator-dot-size;
      height: $at-pull-to-refresh-indicator-dot-size;
      border-radius: 100%;
      margin: $at-pull-to-refresh-indicator-dot-size / 2;
      display: inline-block;
      animation: pull-to-refresh-indicator 0.5s 0s infinite linear;
      animation-fill-mode: both;
      opacity: 0.2;

      &:nth-child(0) {
        animation-delay: -0.1s !important;
      }

      &:nth-child(1) {
        animation-delay: -0.2s !important;
      }

      &:nth-child(2) {
        animation-delay: -0.3s !important;
      }
    }

    &.static .dot {
      animation: none;
    }
  }

  &-down {
    .at-load-more {
      display: none;
    }
  }

  &-up {
    .at-pull-to-refresh-indicator-down {
      display: none;
    }
  }

  &-both.pull-up .at-pull-to-refresh-indicator-down {
    display: none;
  }

  .at-load-more {
    height: $at-pull-to-refresh-indicator-height * 1.3;

    .at-button {
      border: 0;
    }
  }
}

@keyframes pull-to-refresh-indicator {
  50% {
    opacity: 0.2;
  }

  100% {
    opacity: 1;
  }
}
